#include<stdio.h>
#include<string.h>
#include<stdlib.h>

struct STU
{
	char name[21];
	int times;
};

int main(void)
{
	int differ = 0, have, i;
	char temp[21];
	struct STU stu[500];
	while(scanf(" %s",temp),strcmp(temp,"#"))
	{
		have = 0;
		for(i=0;i<differ;i++)
		{
			if(!strcmp(temp,stu[i].name))
			{
				have = 1;
				break;
			}
		}
		if(have){
			stu[i].times+=1;
		}
		else{
			strcpy(stu[differ].name,temp);
			stu[differ].times=1;
			differ+=1;
		}
	}
	int maxi=0;
	for(i=1;i<differ;i++){
		if(stu[i].times>stu[maxi].times)
		{
			maxi=i;
		}
	}
	
	printf("%s",stu[maxi].name);
	
	return 0;
}
